# Maintainer: AndyRTR <andyrtr@archlinux.org>

pkgname=opengl-man-pages
pkgver=20190725
_commit=8acb9c72a30d36a6f7e89b9b2de0635c50773cdb
pkgrel=3
pkgdesc="OpenGL Man Pages - OpenGL 4.x"
arch=('any')
url="https://github.com/KhronosGroup/OpenGL-Refpages"
license=('custom')
makedepends=('docbook5-xml' 'docbook-xsl' 'libxslt' 'docbook-mathml' 'w3c-mathml2' 'python' 'git')
source=(${pkgname}::git+https://github.com/KhronosGroup/OpenGL-Refpages#commit=$_commit
        'LICENSE')
sha256sums=('SKIP'
            'a7b2f6669d7ead91dcaf5a03620cdf9d37c54d83fd1899b4ef84683c7e6d4024')

build() {
  for manpages in gl4; do
    cd "${srcdir}/${pkgname}/${manpages}"
      for file in *.xml; do
        xsltproc --xinclude --noout --nonet /usr/share/xml/docbook/xsl-stylesheets-*/manpages/docbook.xsl ${file}
      done
  done
}

package() {
  install -d "${pkgdir}/usr/share/man/man3"
  for manpages in gl4; do
    cd "${srcdir}/${pkgname}/${manpages}"
    install -m644 *.3G "${pkgdir}/usr/share/man/man3/"
  done
  # license
  install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
